#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----------------------------------------------------------
# -- This's User Model
# -- 
# ****************************
# Author: lmay.Zhou
# Blog: www.lmaye.com
# Date: 2018年2月27日 11:49:49
# ----------------------------------------------------------
from core.app import app, db
# 导入全文搜索
import flask_whooshalchemy


class Post(db.Model):
    """
        Post 数据模型
    """
    __tablename__ = 'posts'
    __searchable__ = ['body']
    id = db.Column(db.Integer, primary_key=True)
    body = db.Column(db.String(140))
    timestamp = db.Column(db.DateTime)
    user_id = db.Column(db.Integer, db.ForeignKey('users.id'))

    def __repr__(self):
        return '<Post %r>' % self.body


flask_whooshalchemy.whoosh_index(app, Post)
